import datetime
import time

from apscheduler.schedulers.blocking import BlockingScheduler
from apscheduler.schedulers.background import BackgroundScheduler
## 配置redis模块
from apscheduler.jobstores.redis import RedisJobStore
## 配置线程
from apscheduler.executors.pool import ThreadPoolExecutor, ProcessPoolExecutor
import settings


REDIS = {
    'host': settings.redishost,
    'port': settings.redisport,
    'db': 3,
    'password': settings.redispwd
}
jobstores = {
    'redis': RedisJobStore(**REDIS)
}
executors = {
    'default': ThreadPoolExecutor(20),#默认线程数
    'processpool': ProcessPoolExecutor(5)#默认进程
}


scheduler = BackgroundScheduler(jobstores=jobstores, executors=executors, timezone='Asia/Shanghai')
scheduler.start()

